package com.ss.android.common.util;

import android.annotation.TargetApi;
import android.os.Build;
import android.webkit.ValueCallback;
import android.webkit.WebView;

public final class LoadUrlUtils {
    static class BaseImpl {
        BaseImpl(byte arg1) {
            this();
        }

        private BaseImpl() {

        }

        public void loadUrl(WebView arg2, String arg3) {
            if (arg2 != null) {
                try {
                    arg2.loadUrl(arg3);
                } catch (Throwable v0) {
                }
            }
        }
    }

    @TargetApi(value = 19)
    static final class KitKatImpl extends BaseImpl {
        KitKatImpl(byte arg1) {
            this();
        }

        private KitKatImpl() {
            super((byte) 0);
        }

        public final void loadUrl(WebView arg3, String arg4) {
            int v0 = 0;
            if (arg3 != null) {
                if (arg4 != null && (arg4.startsWith("javascript:"))) {
                    ValueCallback v1 = null;
                    try {
                        arg3.evaluateJavascript(arg4, v1);
                        v0 = 1;
                    } catch (Throwable v1_1) {
                    }
                }

                if (v0 != 0) {
                    return;
                }

                try {
                    arg3.loadUrl(arg4);
                } catch (Throwable v0_1) {
                }
            }
        }
    }

    private static BaseImpl IMPL = Build.VERSION.SDK_INT >= 19 ? new KitKatImpl((byte) 0) : new BaseImpl((byte) 0);

    public static void loadUrl(WebView arg1, String arg2) {
        LoadUrlUtils.IMPL.loadUrl(arg1, arg2);
    }
}

